package org.liukai.ssh_ems.util;

import org.junit.Test;
import org.liukai.ssh_ems.entity.po.User;
import org.liukai.ssh_ems.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @project ssh_ems
 * @create TestUtil.java 
 * 
 * @author liukai
 * @date 2016/1/13 14:07
 * @detail 
 */
public class TestUtil {
    //测试crud
    @Test
    public void test() {
        String path = "applicationContext.xml";
        ApplicationContext ctx = new ClassPathXmlApplicationContext(path);
        UserService userService = (UserService)ctx.getBean("userService");
        User user = new User();
        user.setUsername("liukai");
        User u = userService.queryUserByusername(user);
        System.out.println(u);
        //EmpService empService = (EmpService)ctx.getBean("empService");
        //EmpDao dao = (EmpDao)ctx.getBean("empDao");
        /*Emp e = new Emp();
        e.setEmpId(7);
        e.setName("lisi");
        empService.updateEmp(e);*/

        //empService.deleteEmp("14");

        /*EmpDao empDao = (EmpDao)ctx.getBean("empDao");
        empDao.deleteEmp("14");*/

        /*List<Emp> list = empService.queryEmpList();
        for(Emp e : list) {
            System.out.println(e);
        }*/

        /*Emp e = dao.queryEmpById("13");
        System.out.println(e);*/
    }
}
